﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.basis
{
    public partial class productconnectionedit : System.Web.UI.Page
    {
        Maticsoft.BLL.InventoryClass bll = new Maticsoft.BLL.InventoryClass();
        Maticsoft.BLL.productsconnection pcbll = new Maticsoft.BLL.productsconnection();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidid.Value = Request["id"];
                this.cklist.DataSource = bll.GetList("(cInvCCode like '05%') and bInvCEnd=1 and cInvCCode<>'" + Request["id"] + "'");
                this.cklist.DataTextField = "cInvCName";
                this.cklist.DataValueField = "cInvCCode";
                this.cklist.DataBind();
                List<Maticsoft.Model.productsconnection> lists = pcbll.GetModelList("cInvCCode='" + Request["id"] + "'");
                foreach (ListItem item in cklist.Items)
                {
                    if (lists.Any(c => c.connectioncInvCCode == item.Value))
                    {
                        item.Selected = true;
                    }
                }
            }
        }
    }
}